/**
 * 
 */
package sailing.managers.impl;

import java.util.List;

import sailing.dao.CashierDao;
import sailing.entity.Cashier;
import sailing.managers.CashierManager;
import cjlite.annotations.Inject;
import cjlite.utils.Lists;

/**
 * @author kevin
 * 
 */
public class CashierManagerImpl implements CashierManager {

	@Inject
	private CashierDao cashierDao;

	private List<Cashier> cashierList = Lists.newArrayList();

	/*
	 * (non-Javadoc)
	 * 
	 * @see sailing.managers.CashierManager#getAllCashierList()
	 */
	@Override
	public List<Cashier> getAllCashierList() {
		cashierList.clear();
		cashierList.addAll(cashierDao.getAllEntityList());
		return cashierList;
	}

	@Override
	public boolean isExist(String cashierName) {
		for (Cashier c : cashierList) {
			if (c.getName().equals(cashierName)) {
				return true;
			}
		}

		return false;
	}

	@Override
	public boolean save(Cashier c) {
		return cashierDao.save(c);
	}

	@Override
	public boolean delete(Cashier cc) {
		return cashierDao.delete(cc);
	}

	@Override
	public boolean update(Cashier cc) {
		return cashierDao.update(cc);
	}

}
